"""
全局变量管理模块
"""


def init(dct=None):  # 初始化
    global _global_dict
    _global_dict = dct if dct is not None else {}


def set_value(key, value):
    _global_dict[key] = value


def get_value(key, def_value=None):
    try:
        return _global_dict[key]
    except KeyError:
        return def_value


def get_global():
    return _global_dict


